<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>uupaa-msgpump.js - uuClass.MsgPump.send, post</title>
<style type="text/css">@import url(../README.css);</style>
<script type="text/javascript" src="http://uupaa-js-spinoff.googlecode.com/svn/trunk/uupaa-detect.js/uupaa-detect.mini.js"></script>
<script type="text/javascript" src="../uupaa-msgpump.js"></script>
</head>
<body>
<div id="log"></div>
<script>
function boot() {
  var XFile = function(uuid, name) {
    this.uuid  = uuid;
    this.agent = name;
  };
  XFile.prototype = {
    msgbox: function(msg, p1, p2) {
      var e = document.getElementById("log");
      e.innerHTML += ["<br />", this.agent, ": accepted message [", msg, "], from ", p1.from].join("");
    }
  };
  var agent1 = new XFile(1, "Agent Mulder");
  var agent2 = new XFile(2, "Agent Scully");
  var agent3 = new XFile(3, "Smoking Man");

  uu.msg.regist(agent1, agent2, agent3);

  uu.msg.post(agent1, "Hello Mulder", { from: "Scully"      });
  uu.msg.post(0,      "Hi All",       { from: "Mulder"      });
  uu.msg.send(agent1, "...",          { from: "Smoking Man" });
  uu.msg.post([agent2, agent3], "Samantha... orz", { from: "Mulder" });
}
window.onload = boot;
</script>
<pre class="eg">
  var XFile = function(uuid, name) {
    this.<b>uuid</b>  = uuid;
    this.agent = name;
  };
  XFile.prototype = {
    <b>msgbox</b>: function(msg, p1, p2) {
      var e = document.getElementById("log");
      e.innerHTML += ["&lt;br /&gt;", this.agent, ": accepted message [", msg, "], from ", p1.from].join("");
    }
  };
  var agent1 = new XFile(1, "Agent Mulder");
  var agent2 = new XFile(2, "Agent Scully");
  var agent3 = new XFile(3, "Smoking Man");

  <b>uu.msg.regist</b>(agent1, agent2, agent3);

  <b>uu.msg.post</b>(agent1, "Hello Mulder", { from: "Scully"      }); <u>// スカリーからモルダーにご挨拶</u>
  <b>uu.msg.post</b>(0,      "Hi All",       { from: "Mulder"      }); <u>// モルダーが(自分も含め)みんなにご挨拶</u>
  <b>uu.msg.send</b>(agent1, "...",          { from: "Smoking Man" }); <u>// スモーキングマンがモルダーだけにお返事</u>
  <b>uu.msg.post</b>([agent2, agent3], "Samantha... orz", { from: "Mulder" }); <u>// モルダーが(自分以外に)いつもの</u>
</pre>
</body></html>
